package com.vincent.filepicker.filter.entity;

import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

/**
 * Created by Vincent Woo
 * Date: 2016/10/11
 * Time: 15:52
 */

public class AudioFile extends BaseFile implements Sequenceable {
    private long duration;

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }

    @Override
    public boolean marshalling(Parcel dest) {
        dest.writeString(getPath());
        dest.writeLong(getDuration());
        return true;
    }

    @Override
    public boolean unmarshalling(Parcel in) {
        setPath(in.readString());
        duration = in.readLong();
        return true;
    }

    public static final Sequenceable.Producer
            PRODUCER = new Sequenceable.Producer
            () {
        public BaseFile createFromParcel(Parcel in) {
            AudioFile instance = new AudioFile();
            instance.unmarshalling(in);
            return instance;
        }
    };
}
